﻿using System.Drawing;

namespace GIMS.Def.Arguments
{
    public enum Shape
    {
        line,
        rectangle,
        circle,
        text
    }

    public class DrawArgument : Argument
    {
        private Shape shape=Shape.line;
        private Point p0=new Point();
        private Point p1 = new Point();
        private string text = "";

        public DrawArgument()
        {
            name = "Draw Argument";
            type=Flags.ArgumentType.draw;
        }

        public Shape Shape
        {
            get { return shape; }
            set
            {
                shape = value;
                OnPropertyChanged("SelectedShape");
            }
        }

        public int P0X
        {
            get { return P0.X; }
            set
            {
                p0.X = value;
                OnPropertyChanged("draw");
            }
        }

        public int P0Y
        {
            get { return P0.Y; }
            set
            {
                p0.Y = value;
                OnPropertyChanged("draw");
            }
        }

        public Point P0
        {
            get { return p0; }
            set
            {
                p0 = value;
                OnPropertyChanged("draw");
            }
        }

        public int P1X
        {
            get { return P1.X; }
            set
            {
                p1.X = value;
                OnPropertyChanged("draw");
            }
        }

        public int P1Y
        {
            get { return P1.Y; }
            set
            {
                p1.Y = value;
                OnPropertyChanged("draw");
            }
        }

        public Point P1
        {
            get { return p1; }
            set
            {
                p1 = value;
                OnPropertyChanged("draw");
            }
        }

        public string Text
        {
            get { return text; }
            set
            {
                text = value;
                OnPropertyChanged("draw");
            }
        }

        public override string CreateScriptPart()
        {
            if (Shape == Shape.text)
            {
                return string.Concat("\"",Shape.ToString()," ",P0.X,",",P0.Y," '",Text,"'\"");
            }
            else
            {
                return string.Concat("\"", Shape.ToString(), " ", P0.X, ",", P0.Y, " ", P1.X, ",", P1.Y, "\"");
            }
        }
    }
}
